home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
(A)G
/
(A)G6.ADF
/
robatusen
< prev
next >
Wrap
Text File
|
1988-05-24
|
8KB
|
236 lines
equate count 0
equate dist 1
equate tempa 2
equate tempb 3
equate tempc 4
equate xtarg 5
equate ytarg 6
equate xdrd 7
equate ydrd 8
equate flag 9
equate width 10
equate angle 11
equate scwidth 12
equate scangle 13
equate scflag 14
equate tdist 15
equate xfire 16
equate yfire 17
equate xvel 18
equate yvel 19
equate scnmv 3 \ how far it moves between time it records x,y \
\ and the time it scans \
equate frmv 8 \ how far it moves between the time it scans \
\ and the time it fires \
cpu 2x32bit
drive track 70
weapon lgun 60 150
weapon lgun 60 150
weapon lgun 60 150
weapon lgun 60 150
reg 20
# 50 sto xtarg sto ytarg
sto scwidth
# 0 sto scflag
# 180 sto count \ figure out closest wall, assume left \
# 50 posx sto tempa \ dist to left wall \
x<y? goto jlp1 \ if posx<50?, go left \
# 100 swap - sto tempa \ dist to right wall \
# 0 sto count \ go right \
label jlp1
# 270 sto tempb \ assume bottom wall \
# 50 posy sto tempc \ dist to bottom wall \
x<y? goto jlp2 \ if posy<50?, go down \
# 100 swap - sto tempc \ dist to top wall \
# 90 sto tempb \ go up \
label jlp2
rcl tempa \ dist left-right \
rcl tempc \ dist up-down \
x>y? goto jlp3 \ if left-right is closer than up-down,\
rcl tempb sto count \ then use it, else use up-down. \
label jlp3
\************************** look ahead ***********************\
label lookah \ look where you're about to go \
rcl count sin sto yvel \ plus or minus 1 or 0 for y velocity \
rcl count cos sto xvel
# 10 sto width
rcl count sto angle radar \ scan in direction of travel (count) \
x<0? goto jmpov1 \ don't look if there's nothing to look at. \
gosub halffi \ if there's something there, kill it! \
rcl flag # 1 x=y? goto lookah \ if found and lost something, look again \
label jmpov1
# 10 sto width \ be paranoid, check behind \
rcl count # 180 + sto angle
radar
x<0? goto jmpov2 \ don't look for nothing. \
gosub halffi \ haha! I knew it was there! \
rcl flag # 1 x=y? goto lookah \ there may be more of them out there, \
\ I just know it. \
label jmpov2
\************************** move along walls **************************\
label forwar \ go forward!!! \
rcl count heading
rcl count # 80 x<y? goto grp1 \ if going right... \
posx sto xdrd sto xfire
posy sto ydrd sto yfire
# 100 rcl xdrd - speed \ set right speed \
# 7 x>y? goto turn \ turn if close to edge \
# scnmv sto+ xdrd \ where it will be \
# frmv sto+ xfire
gosub dodada \ scan 360, aim and fire \
goto forwar \ move on \
label grp1
rcl count # 170 x<y? goto grp2 \ if going up... \
posx sto xdrd sto xfire
posy sto ydrd sto yfire
# 100 rcl ydrd - speed \ set up speed \
# 7 x>y? goto turn \ turn if close to edge \
# scnmv sto+ ydrd \ where it will be \
# frmv sto+ yfire
gosub dodada \ scan, aim, fire \
goto forwar \ move on \
label grp2
rcl count # 260 x<y? goto grp3 \ if going left... \
posx sto xdrd sto xfire
posy sto ydrd sto yfire
rcl xdrd speed \ set left speed \
# 7 x>y? goto turn \ turn if close to edge \
# scnmv sto- xdrd \ where it will be \
# frmv sto- xfire
gosub dodada \ scan, aim, fire \
goto forwar \ move on \
label grp3 \ obviously going down... \
posx sto xdrd sto xfire
posy sto ydrd sto yfire
rcl ydrd speed \ set down speed \
# 7 x>y? goto turn \ turn if close to edge \
# scnmv sto- ydrd \ where it will be \
# frmv sto- yfire
gosub dodada \ scan, aim, fire \
goto forwar \ move on \
\*************************** turn around **************************\
label turn \ turn around \
# 0 speed
# 350
rcl count # 90 + \ turn by 90 degrees \
x>y? # 0 \ if count<350, use it; otherwise set to 0 \
sto count goto lookah \ check ahead and move on \
\************************* figure it all out.. **********************\
label dodada \ scflag: 0: scan at scangle \
\ 1: scan left one width \
\ 2: scan right one width \
rcl ytarg rcl ydrd - \ delta y \
rcl xtarg rcl xdrd - \ delta x \
atan2 sto scangle \ angle to scan at \
rcl scflag x=0? goto isalri \ if it's ok to scan there, do so \
# 1.5 x>y? goto lkleft \ if scflag=1, scan to left \
rcl scangle rcl scwidth - \ else look to the right one width \
sto scangle goto isalri \ and go to scan there \
label lkleft
rcl scangle rcl scwidth + \ going to look left one width \
sto scangle
label isalri
rcl scwidth rcl scangle \ get width and angle \
radar x>0? goto isinbeam \ something is in the beam \
rcl scflag # 1 + \ increment scflag by 1 \
# 3 x!=y? return \ if not 3, keep moving \
# 2 sto* scwidth \ double scan width \
# 1 sto scflag \ set to look left next time we're here \
return \ go back to moving \
label isinbeam
sto tdist
rcl scangle sin *
rcl ydrd + sto ytarg \ new y coordinate for target \
rcl scangle cos rcl tdist *
rcl xdrd + sto xtarg \ new x coordinate for target \
# 0 sto scflag \ reset scflag for next time through \
# .6 rcl scwidth *
# 4 rcl tdist / r-d \ angular width of 4 meter at tdist \
x<y? swap \ don't let the width become too small \
sto scwidth \ cut scan width to .7 of its value \
d-r rcl tdist * \ width of beam in meters at distance of droid \
# 6 x<y? return \ if not within 6 meters, don't fire. \
rcl tdist # 10 / sto tempa \ dist shot will drift from \
\ includes speed of shot and speed of droid \
rcl xtarg rcl xfire - rcl tempa rcl xvel * - sto tempb
rcl ytarg rcl yfire - rcl tempa rcl yvel * - rcl tempb
atan2 aim
rcl tdist
fire 0 fire 1 fire 2 fire 3 \ nuke the damn thing! \
return \ try again \
\**************************************************************************\
label halffi \ subroutine, pass in: width
angle
returns: flag 0: found nothing
1: found and lost
2: got hit here \
sto dist \ save dist for later use \
rcl width # .6
x>y? goto adjus \ if less than .6 deg., fire \
rdn # 2 / sto width \ half the width \
sto+ angle \ scan to the left \
rcl angle radar
x>0? goto halffi \ if something there, keep going \
rcl width # 2 * sto- angle \ scan to right \
rcl width rcl angle radar
x>0? goto halffi \ if something there, keep going \
# 0 sto flag return \ found nothing to shoot at, return. \
label adjus
rcl angle
# 1.5 rcl dist / atan
sto- angle \ move to the right a bit. \
rcl angle aim
rcl dist
label fire1
sto dist
fire 0 fire 1 \ fire dead on. \
fire 2 fire 3
rcl angle aim aim \ delay \
# 0 rcl angle \ is it still there? \
radar x>0? goto fire1
# 3 rcl dist / atan
sto width \ four droid widths \
enter rcl angle + sto angle \ look to the left. \
radar x>0? goto halffi \ if it's there, find it. \
rcl width enter # 2 *
rcl angle swap - sto angle \ look to the right. \
rcl width rcl angle radar
x>0? goto halffi \ if it's there, find it. \
# 1 sto flag \ lost it. \
return
\**************************************************************************\